package org.freedom.fastdevpt.core.base;

import java.time.LocalDateTime;

import org.freedom.fastdevpt.utils.GosDateUtils;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;

public class BaseEntity {

	private long createtime;
	@JsonFormat(pattern = "yyyyMMdd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyyMMdd HH:mm:ss")
	private LocalDateTime lastmodify;
	private int version;
	
	
	public BaseEntity() {
		super();
	}

	public BaseEntity(long createtime, LocalDateTime lastmodify, int version) {
		super();
		this.createtime = createtime;
		this.lastmodify = lastmodify;
		this.version = version;
	}

	public long getCreatetime() {
		return createtime;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public void setCreatetime(long createtime) {
		this.createtime = createtime;
	}

	public LocalDateTime getLastmodify() {
		return lastmodify;
	}

	public void setLastmodify(LocalDateTime lastmodify) {
		this.lastmodify = lastmodify;
	}
	public String getLast(){
		if(this.lastmodify!=null )
		return GosDateUtils.formateDateTime(this.lastmodify);
		return null;
	}
	public String getCreate() {
		 
		return GosDateUtils.formatLongTime(this.createtime*1000);
	}
}
